home *** CD-ROM | disk | FTP | other *** search
- #! /usr/bin/perl
-
- #touch /tmp/podder_this_cron.txt
-
- # iPodderX Cron Script
- # Contributed by Dave Slusher
- #
- # Based on original and rather faulty script
- # by August Trometer
-
- $parameter = shift;
- $command = shift;
- $minute = -1;
-
- if ($minute == -1) {
- $minute = int(rand(60));
- }
-
- $cron = "";
-
- if ($parameter == 1 ) {
- $cron = "$minute * * * * $command >> /dev/null 2>&1";
- }
- if ($parameter == 2 ) {
- $cron = "$minute */3 * * * $command >> /dev/null 2>&1";
- }
- if ($parameter == 3 ) {
- $cron = "$minute */6 * * * $command >> /dev/null 2>&1";
- }
- if ($parameter == 4 ) {
- $cron = "$minute */12 * * * $command >> /dev/null 2>&1";
- }
- if ($parameter == 5 ) {
- $cron = "$minute 1 * * * $command >> /dev/null 2>&1";
- }
- if ($parameter == 6 ) {
- $cron = "$minute 1 */2 * * $command >> /dev/null 2>&1";
- }
-
- system("crontab -l | grep -v \'iPodderX\' | cat > /tmp/podder_this_cron.txt");
-
- open (OUTPUT, ">>/tmp/podder_this_cron.txt") || die "Cannot add cron line to temp file";
- print OUTPUT "$cron\n";
- close OUTPUT;
-
- system("crontab /tmp/podder_this_cron.txt");
-
- exit;